using System;
using System.Data;
using Persistencia;
using SearchServer.Exceptions;

namespace SearchServer.AppManager
{
	public class LogManager {

        private LogMgr.ILogMgr _logManager;

		public LogManager(){
            _logManager = new LogMgr.LogMgr();
		}

		public static LogManager GetInstancia(){
			return new LogManager();
		}

		/// 
        /// <param name="user"></param>
		/// <param name="searchText"></param>
		public void LogBusquedaRealizada(Usuario user, string searchText){
            try
            {
                TimeMgr.ITimeMgr mgr = new TimeMgr.TimeMgr();
                DateTime fecha = mgr.ObtenerFecha();
                _logManager.LogBusquedaRrealizada(user, fecha, searchText);
            }
            catch (DataException dataException)
            {
                throw new BusinessException(BusinessException.ERROR_BD);
            }
		}

	}

}